﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.Diagnostics.Contracts;

namespace YasharEl.Infrastructure.Core.Personification
{
    public class Name : ValueObject<Name>
    {
        #region Fields

        private readonly string _firstname;
        private readonly string _middleName;
        private readonly string _lastname;

        #endregion

        #region Constructors

        private Name()
        {

        }

        public Name(string firstname, string middleName, string lastname)
        {
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(firstname), "firstname could not be null or empty.");
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(lastname), "lastname could not be null or empty.");

            _firstname = firstname;
            _middleName = middleName;
            _lastname = lastname;
        }

        #endregion

        #region Properties

        public string Firstname
        {
            get { return _firstname; }
        }

        public string Lastname
        {
            get { return _lastname; }
        }

        public string MiddleName
        {
            get { return _middleName; }
        }

        #endregion

        #region Object Overrides

        public override string ToString()
        {
            return string.Format("Last name : {0}, first name : {1}, middle name : {2}", Lastname, Firstname, MiddleName);
        }

        #endregion
    }
}
